<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>JS基本语法</title>
    <script type="text/javascript">
        var age = 18;
        var money = 100.88;
        var name = 'jack';
        var name2 = "rose";
        var result = true;
        var number = null;
        var number2 = undefined;

//        输出
        console.log(age, money, name, name2, result, number, number2);

//        变量的真实类型
        console.log(typeof age, typeof money, typeof name, typeof name2, typeof result, typeof number, typeof number2);

//        基本数据类型的运算
        var newName = name + name2;
        console.log(newName);

        // 题目
        var str1 = 10 + 10 + '10';

        // 数组
        var numbers = [-10, 'sam', name, result, number, ['haha', 'hehe', 1]];

        // 遍历数组
        for(var i = 0; i < numbers.length; i++) {
            console.log(numbers[i]);
        }

        for (var i in numbers) {
            console.log(numbers[i]);
        }

        // JS中常用属性
        // 删除数组中最后一个元素
        numbers.pop();
        numbers.push(['haha', 'hehe', 1])

        // JS常用类库 Math
        var numberArray = [10, 20, 30, 40, 50, 60];
        var maxNumber = Math.max(210, 32, 14);
        var newMaxNumber = Math.max.apply(this, numberArray);
        console.log(maxNumber);
        console.log(newMaxNumber);
    </script>
</head>
<body>
    <button onclick="alert('点了');">点我啊</button>
</body>
</html>